package com.atugigu.demo.customer.service.impl;

import com.atugigu.demo.customer.bean.Customer;
import com.atugigu.demo.customer.mapper.CustomerMapper;
import com.atugigu.demo.customer.service.CustomerService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service //标识位容器的 服务组件  //在整个服务启动是就会创建对象 默认单态
@DS("mysql0408")
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService  {

//    @Autowired
//    CustomerMapper customerMapper;


    @Override
    public void saveCustomer(Customer customer) {
        System.out.println("save customer:"+customer);
        super.baseMapper.insertCustomer(customer);
    }

    @Override
    public Customer getCustomerById(String id) {
       // Customer customer = customerMapper.selectCustomerById(id);
        Customer customer = baseMapper.selectById(id);

        return customer;
    }
}
